/***********************************************************************
 * Module:  File.java
 * Author:  zhangpei
 * Purpose: Defines the Class File
 ***********************************************************************/

package com.afteryuan.engine.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;
import com.afteryuan.dao.BaseObject;

@Entity
@Table(name = "T_File")
@DiscriminatorColumn(name="Discriminator", discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue("File")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Proxy(lazy = false)
public class File extends BaseObject {
	/** 序号 */
	private java.lang.String id;

	/** 旧文件名 */
	private java.lang.String originalName;

	/** 新文件名 */
	private java.lang.String currentName;

	/** mime类型 */
	private String mime;

	/** 文件地址 */
	private java.lang.String path;

	/** 文件大小 */
	private Integer fileSize;

	/** 文件扩展名 */
	private java.lang.String ext;
	
	
	private java.lang.Long createTime;

    public File() {
        setCreateTime(new Date().getTime());
    }

    public File(String id) {
        setId(id);
        setCreateTime(new Date().getTime());
    }
 
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public java.lang.String getId() {
		return id;
	}

	public void setId(java.lang.String id) {
        if("".equals(id))id=null;
		this.id = id;
	}

	public java.lang.Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(java.lang.Long createTime) {
		this.createTime = createTime;
	}

	public java.lang.String getCurrentName() {
		return currentName;
	}

	public void setCurrentName(java.lang.String currentName) {
		this.currentName = currentName;
	}

	public java.lang.String getExt() {
		return ext;
	}

	public void setExt(java.lang.String ext) {
		this.ext = ext;
	}

	public String getMime() {
		return mime;
	}

	public void setMime(String mime) {
		this.mime = mime;
	}
    
    @Column(name="ORIGINANAME")
	public java.lang.String getOriginalName() {
		return originalName;
	}

	public void setOriginalName(java.lang.String originalName) {
		this.originalName = originalName;
	}

	public java.lang.String getPath() {
		return path;
	}

	public void setPath(java.lang.String path) {
		this.path = path;
	}

	
	public Integer getFileSize() {
		return fileSize;
	}

	public void setFileSize(Integer fileSize) {
		this.fileSize = fileSize;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		File file = (File) o;

		if (id != null ? !id.equals(file.id) : file.id != null)
			return false;

		return true;
	}

	public int hashCode() {
		return (id != null ? id.hashCode() : 0);
	}

	public String toString() {
		return "File{" + "id='" + id + '\'' + ", originalName='" + originalName
				+ '\'' + ", currentName='" + currentName + '\'' + ", mime='"
				+ mime + '\'' + ", path='" + path + '\'' + ", fileSize=" + fileSize
				+ ", ext='" + ext + '\'' + ", createTime=" + createTime + '}';
	}
	
}